#ifndef DROIDMEDIAPLAYER_THREAD_H
#define DROIDMEDIAPLAYER_THREAD_H

#include <pthread.h>
#include "common.h"

class Thread {

public:
    Thread();
    virtual ~Thread();

    void start();

    int join();

    void waitOnNotify();
    void notify();
    virtual void stop();

protected:
    bool mRunning;

    virtual void handleRun(void* ptr);

private:
    pthread_t mThread;
    pthread_mutex_t mLock;
    pthread_cond_t mCondition;

    static void* startThread(void* ptr);

};

#endif //DROIDMEDIAPLAYER_THREAD_H
